package cn.itgod.controller;

import cn.itgod.dto.EmployeeLoginDTO;
import cn.itgod.entity.Result;
import cn.itgod.service.EmpService;
import cn.itgod.vo.EmployeeLoginVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/employee")
public class EmpController {
    @Autowired
    private EmpService empService;

    /**
     * 员工登录系统
     */
    @PostMapping("/login")
    public Result empLogin(@RequestBody EmployeeLoginDTO employeeLoginDTO){
        EmployeeLoginVo finalResult = empService.empLogin(employeeLoginDTO);
        return finalResult == null ? Result.error("用户名或密码错误") : Result.success(finalResult);
    }
    @PostMapping ("/logout")
    public Result logout(){
        return Result.success("2");
    }
}
